﻿using System;
using System.ComponentModel;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ListControl = Bonesoft.Controls.ListControl;

namespace Bonesoft.Controls
{
    public partial class ListCommandManager : IComponent
    {
        private XtraForm form;

        public XtraForm Form
        {
            get
            {
                return form;
                
            }
            set
            {

                form = value;
                if (form != null)
                {
                    form.KeyDown += Form_KeyDown;
                }
                
            }
        }

        public ListControl ListControl { get; set; }

        void Form_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
                    case Keys.F5:
                    ListControl.Excluir();
                    break;
                    case Keys.F6:
                    ListControl.Novo();
                    break;
                    case Keys.F7:
                    ListControl.Alterar();
                    break;
            }
        }

        public ListCommandManager()
        {
            
        }

        public void Dispose()
        {
            
        }

        public ISite Site { get; set; }
        public event EventHandler Disposed;
    }
}
